package bdz.projects.atwww.electrolux.model.core
{
	public dynamic class ELOptions extends Array {
		private var _alias:String;
		public function ELOptions(xm:XMLList) {
			super();
			initialize(xm);
		}
		private function initialize(xm:XMLList):void{
			for each(var xo:XML in xm){
				push(new ELOption(xo));
			}
		}
		public function get selectedOptions():Array{
			var retarr:Array = new Array();
			for each(var el:ELOption in this){
				if(el.included){
					retarr.push(el.selected);
				}
			}
			return retarr;
		}
		
		public function get serialized():XMLList{
			var opts:XMLList = new XMLList();
			var counter:Number = 0;
			for each(var eo:ELOption in this){
				opts[counter] = eo.serialize;
				counter++;
			}
			return opts;
		}
		public function getOptionWithAlias(str:String):ELOption {
			for each(var opt:ELOption in this){
				if(opt.alias == str){
					return opt;
				}
			}
			return null;
		}
		
	}
}